package com.springboot.controller;

import com.springboot.service.StudentService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class StudentController {
	
	@Autowired
	private StudentService studentService;
	

	@GetMapping("getByName/{name}")
  public List<Map<String, Object>>  getByName(@PathVariable  String name){
    System.out.println("=====name===="+name);
    List list1 = this.studentService.getAllStudentsFromDb1(name);
    System.out.println("===111=====" +list1.size());
    List list2 = this.studentService.getAllStudentsFromDb2(name);
    System.out.println("====2222====" +list2.size());
    list1.addAll(list2);
	  return list1;
  }

}
